home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / cpp_libs / answrbok / 5_10.lha / 5_10 / 5_10c5.c < prev    next >
Text File  |  1993-08-08  |  980b  |  39 lines

  1. * Copyright (c) 1990 by AT&T Bell Telephone Laboratories, Incorporated. */
  2. * The C++ Answer Book */
  3. * Tony Hansen */
  4. * All rights reserved. */
  5. / Exercise 5.10
  6. / demonstration program showing the use
  7. / of the tableentry class
  8. include <stream.h>
  9. include <tableentry.h>
  10. include "5_10c1.h"    /* DELETE tableentry::tableentry() */
  11. include "5_10c2.h"    /* DELETE tableentry::~tableentry() */
  12. include "5_10c3.h"    /* DELETE tableentry::getvardata() */
  13. include "5_10c4.h"    /* DELETE tableentry::settype() */
  14.  
  15. ableentry namespace;
  16.  
  17. oid showvar(char *varname)
  18.  
  19.    vardata *v;
  20.    int newvar = namespace.getvardata(varname, &v);
  21.    cout << "name='" << varname << "'\n";
  22.    cout << "\taddress=" << v->address << "\n";
  23.    cout << "\ttype=" << chr(v->type) << "\n";
  24.    if (newvar)
  25.        cout << "\tvariable is new\n";
  26.  
  27.  
  28. ain(int,char**)
  29.  
  30.    showvar("hello#");
  31.    showvar("there!");
  32.    showvar("howare#");
  33.    showvar("you");
  34.    showvar("hello#");
  35.    showvar("howare!");
  36.    showvar("you");
  37.    return 0;
  38.  
  39.